<?php header("Access-Control-Allow-Origin:*");

if (empty($_ENV)) {
    $WEB_ROOT = dirname(dirname(dirname(dirname(__DIR__))));
    require $WEB_ROOT . "/vendor/autoload.php";
    $dotenv = Dotenv\Dotenv::createImmutable($WEB_ROOT);
    $dotenv->load();
}

if (empty($_ENV)) {
    echo "config file does't exist";exit;
}

require 'SzPublish.class.php';

$publisher = SzPublish::get();
$version = $publisher->getAppVersion();
$developer = $publisher->getDeveloper();
unset($publisher);
if (!file_exists("apps/{$developer}/{$version}/config/database.config.php")) {
    echo 'database.config.php is empty';
}
$appConfigs = require "apps/{$developer}/{$version}/config/database.config.php";


$redisConfig = $appConfigs['Redis'][0]['READER_HOST'][0];
if (!$redisConfig) {
    echo 'redis config is null';
    exit;
}

list($ip,$port) = $redisConfig;
$redisDb = new Redis();
$redisDb->connect($ip,$port);
$status = $_REQUEST['status'];
if ($status) {
    $status = 1;
} else {
    $status = 0;
}
$redisDb->set('FT-CACHE_KEY_MORE_GAME_STATUS',$status);
echo 'ok.';
